package com.netdisk.mapper;

import com.netdisk.entity.Favorite;
import com.netdisk.entity.File;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FavoriteMapper {
    void insert(File file);

    void delete(File file);

    @Select("select * from favorites where id = #{id}")
    Favorite getFavoriteById(Integer id);

    /*获得收藏文件总数*/
    @Select("select count(*) from favorites")
    Integer getFavoriteCount();

    @Select("select * from favorites where user_id = #{userId} limit 0,10;")
    List<Favorite> getFavoriteListById(Integer userId);


}
